//
//  JCSeekCollectionViewCell.m
//  ABookOfCartoon
//
//  Created by 美国大狗 on 15-5-13.
//  Copyright (c) 2015年 Power Of Ants. All rights reserved.
//

#import "JCSeekCollectionViewCell.h"
#import "UIImageView+WebCache.h"

@interface JCSeekCollectionViewCell ()
@property (nonatomic, retain)UIImageView *picOfCata;
@property (nonatomic, retain)UILabel *carOfCata;
@end

@implementation JCSeekCollectionViewCell
- (instancetype) initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //加分类图
        self.picOfCata = [[UIImageView alloc] init];
        [self.contentView addSubview:_picOfCata];
        [_picOfCata release];
        //加分类名
        self.carOfCata = [[UILabel alloc] init];
        [self.contentView addSubview:_carOfCata];
        [_carOfCata release];
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    _picOfCata.frame = CGRectMake(0, 0, self.contentView.bounds.size.width, self.contentView.bounds.size.height - 30);
    _carOfCata.frame = CGRectMake(0, self.picOfCata.frame.size.height, self.contentView.bounds.size.width, 30);
}
- (void)setModel:(JCSeekPageModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
//    [_picOfCata sd_setImageWithURL:[NSURL URLWithString:model.pic]];
    [_picOfCata sd_setImageWithURL:[NSURL URLWithString:model.CatalogOtherURL]placeholderImage:[UIImage imageNamed:@"/Users/dlios/ABookOfCartoon/ABookOfCartoon/9.jpg"]];
    _carOfCata.text = model.CatalogName;
    _carOfCata.textAlignment = UITextAlignmentCenter;
}

@end
